package com.deng.dubbo.consumer.service.imp;

import com.deng.dubbo.library.IUserService;
import com.deng.dubbo.library.User;

/**
 * @Author DengLibin
 * @Date 19-5-16
 * @Time 上午10:34
 * @Desc 本地存根 调用远程接口之前先调用该接口 在@Reference注解中配置
 */
public class UserServiceStub implements IUserService {
    private IUserService userService;
    public UserServiceStub (IUserService userService){
        this.userService = userService;
    }
    @Override
    public User getById(int id) {
        if(id == 0){
            System.out.println("id非法");
            return null;
        }
        return userService.getById(id);
    }
}
